<template>
  <div>
    <van-goods-action>
      <van-goods-action-icon icon="chat-o" text="客服" color="#ee0a24" @click="handleClick"/>
      <van-goods-action-icon :icon="isCollected? 'star' :'star-o'" :text="isCollected? '已收藏':'未收藏'" :color="isCollected? '#ff5000':'#333'" @click="isCollected=!isCollected"/>
      <van-goods-action-icon icon="cart-o" text="购物车" :badge="count" @click="$router.push('/cart')"/>
      <van-goods-action-button type="warning" text="加入购物车" @click="goToCart"/>
      <van-goods-action-button type="danger" text="立即购买" @click="handleClick"/>
    </van-goods-action>
  </div>
</template>

<script>
export default {
  props:['goodsCount'],
  data(){
    return{
      isCollected:false,
      count:0
    }
  },
  watch:{
    goodsCount(newVal){
      this.count = newVal;
    }
  },
  methods:{
    handleClick(){
      this.$toast('该功能暂未开放！')
    },
    goToCart(){
      this.$emit('goToCart')
    }
  }
};
</script>

<style lang="less" scoped>
.van-goods-action{
  z-index: 99999;
}
</style>
